home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 October: Mac OS SDK / Dev.CD Oct 97 SDK1.toast / Development Kits (Disc 1) / Interfaces&Libraries / Universal / Interfaces / CIncludes / GXEnvironment.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-08-12  |  9.3 KB  |  267 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        GXEnvironment.h
  3.  
  4.      Contains:    QuickDraw GX environment constants and interfaces
  5.  
  6.      Version:    Technology:    Quickdraw GX 1.1
  7.                  Release:    Universal Interfaces 3.0.1
  8.  
  9.      Copyright:    © 1994-1997 by Apple Computer, Inc., all rights reserved.
  10.  
  11.      Bugs?:        Please include the the file and version information (from above) with
  12.                  the problem description.  Developers belonging to one of the Apple
  13.                  developer programs can submit bug reports to:
  14.  
  15.                      devsupport@apple.com
  16.  
  17. */
  18. #ifndef __GXENVIRONMENT__
  19. #define __GXENVIRONMENT__
  20.  
  21. #ifndef __CONDITIONALMACROS__
  22. #include <ConditionalMacros.h>
  23. #endif
  24. #ifndef __MIXEDMODE__
  25. #include <MixedMode.h>
  26. #endif
  27. #ifndef __QUICKDRAW__
  28. #include <Quickdraw.h>
  29. #endif
  30. #ifndef __GXTYPES__
  31. #include <GXTypes.h>
  32. #endif
  33. #ifndef __CMAPPLICATION__
  34. #include <CMApplication.h>
  35. #endif
  36.  
  37.  
  38.  
  39. #if PRAGMA_ONCE
  40. #pragma once
  41. #endif
  42.  
  43. #ifdef __cplusplus
  44. extern "C" {
  45. #endif
  46.  
  47. #if PRAGMA_IMPORT
  48. #pragma import on
  49. #endif
  50.  
  51. #if PRAGMA_STRUCT_ALIGN
  52.     #pragma options align=mac68k
  53. #elif PRAGMA_STRUCT_PACKPUSH
  54.     #pragma pack(push, 2)
  55. #elif PRAGMA_STRUCT_PACK
  56.     #pragma pack(2)
  57. #endif
  58.  
  59. #if defined(__MWERKS__) && TARGET_CPU_68K
  60.     #pragma push
  61.     #pragma pointers_in_D0
  62. #endif
  63.  
  64. /* old header = graphics macintosh */
  65.  
  66.  
  67. enum {
  68.     defaultPollingHandlerFlags    = 0x00,
  69.     okToSwitchDuringPollFlag    = 0x00,
  70.     dontSwitchDuringPollFlag    = 0x01
  71. };
  72.  
  73. typedef long                             gxPollingHandlerFlags;
  74. typedef CALLBACK_API_C( void , gxPollingHandlerProcPtr )(long reference, gxPollingHandlerFlags flags);
  75. typedef STACK_UPP_TYPE(gxPollingHandlerProcPtr)                 gxPollingHandlerUPP;
  76. enum { uppgxPollingHandlerProcInfo = 0x000003C1 };                 /* no_return_value Func(4_bytes, 4_bytes) */
  77. #define NewgxPollingHandlerProc(userRoutine)                     (gxPollingHandlerUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppgxPollingHandlerProcInfo, GetCurrentArchitecture())
  78. #define CallgxPollingHandlerProc(userRoutine, reference, flags)  CALL_TWO_PARAMETER_UPP((userRoutine), uppgxPollingHandlerProcInfo, (reference), (flags))
  79. EXTERN_API_C( gxPollingHandlerUPP )
  80. GXGetGraphicsPollingHandler        (long *                    reference)                            THREEWORDINLINE(0x303C, 0x0245, 0xA832);
  81.  
  82. EXTERN_API_C( void )
  83. GXSetGraphicsPollingHandler        (gxPollingHandlerUPP     handler,
  84.                                  long                     reference)                            THREEWORDINLINE(0x303C, 0x0246, 0xA832);
  85.  
  86. /* old header = graphics toolbox */
  87.  
  88.  
  89. /* QD to QD GX Translator typedefs */
  90.  
  91. enum {
  92.     gxDefaultOptionsTranslation    = 0x0000,
  93.     gxOptimizedTranslation        = 0x0001,
  94.     gxReplaceLineWidthTranslation = 0x0002,
  95.     gxSimpleScalingTranslation    = 0x0004,
  96.     gxSimpleGeometryTranslation    = 0x0008,                        /* implies simple scaling */
  97.     gxSimpleLinesTranslation    = 0x000C,                        /* implies simple geometry & scaling */
  98.     gxLayoutTextTranslation        = 0x0010,                        /* turn on gxLine layout (normally off) */
  99.     gxRasterTargetTranslation    = 0x0020,
  100.     gxPostScriptTargetTranslation = 0x0040,
  101.     gxVectorTargetTranslation    = 0x0080,
  102.     gxPDDTargetTranslation        = 0x0100,
  103.     gxDontConvertPatternsTranslation = 0x1000,
  104.     gxDontSplitBitmapsTranslation = 0x2000
  105. };
  106.  
  107. typedef long                             gxTranslationOption;
  108.  
  109. enum {
  110.     gxContainsFormsBegin        = 0x0001,
  111.     gxContainsFormsEnd            = 0x0002,
  112.     gxContainsPostScript        = 0x0004,
  113.     gxContainsEmptyPostScript    = 0x0008
  114. };
  115.  
  116. typedef long                             gxTranslationStatistic;
  117.  
  118. enum {
  119.     gxQuickDrawPictTag            = FOUR_CHAR_CODE('pict')
  120. };
  121.  
  122. struct gxQuickDrawPict {
  123.                                                                 /* translator inputs */
  124.     gxTranslationOption             options;
  125.     Rect                             srcRect;
  126.     Point                             styleStretch;
  127.  
  128.                                                                 /* size of quickdraw picture data */
  129.     unsigned long                     dataLength;
  130.  
  131.                                                                 /* file alias */
  132.     gxBitmapDataSourceAlias         alias;
  133. };
  134. typedef struct gxQuickDrawPict gxQuickDrawPict;
  135.  
  136. /* WindowRecord utilities */
  137. EXTERN_API_C( gxViewPort )
  138. GXNewWindowViewPort                (WindowPtr                 qdWindow)                            THREEWORDINLINE(0x303C, 0x0236, 0xA832);
  139.  
  140. EXTERN_API_C( gxViewPort )
  141. GXGetWindowViewPort                (WindowPtr                 qdWindow)                            THREEWORDINLINE(0x303C, 0x0237, 0xA832);
  142.  
  143. EXTERN_API_C( WindowPtr )
  144. GXGetViewPortWindow                (gxViewPort             portOrder)                            THREEWORDINLINE(0x303C, 0x0238, 0xA832);
  145.  
  146. /* GDevice utilities */
  147. EXTERN_API_C( GDHandle )
  148. GXGetViewDeviceGDevice            (gxViewDevice             theDevice)                            THREEWORDINLINE(0x303C, 0x0239, 0xA832);
  149.  
  150. EXTERN_API_C( gxViewDevice )
  151. GXGetGDeviceViewDevice            (GDHandle                 qdGDevice)                            THREEWORDINLINE(0x303C, 0x023A, 0xA832);
  152.  
  153. /* gxPoint utilities */
  154. EXTERN_API_C( void )
  155. GXConvertQDPoint                (const Point *            shortPt,
  156.                                  gxViewPort             portOrder,
  157.                                  gxPoint *                fixedPt)                            THREEWORDINLINE(0x303C, 0x023B, 0xA832);
  158.  
  159. typedef CALLBACK_API_C( OSErr , gxShapeSpoolProcPtr )(gxShape toSpool, long refCon);
  160. /* printing utilities typedef */
  161. typedef CALLBACK_API_C( void , gxUserViewPortFilterProcPtr )(gxShape toFilter, gxViewPort portOrder, long refCon);
  162. typedef CALLBACK_API_C( long , gxConvertQDFontProcPtr )(gxStyle dst, long txFont, long txFace);
  163. typedef STACK_UPP_TYPE(gxShapeSpoolProcPtr)                     gxShapeSpoolUPP;
  164. typedef STACK_UPP_TYPE(gxUserViewPortFilterProcPtr)             gxUserViewPortFilterUPP;
  165. typedef STACK_UPP_TYPE(gxConvertQDFontProcPtr)                     gxConvertQDFontUPP;
  166. enum { uppgxShapeSpoolProcInfo = 0x000003E1 };                     /* 2_bytes Func(4_bytes, 4_bytes) */
  167. enum { uppgxUserViewPortFilterProcInfo = 0x00000FC1 };             /* no_return_value Func(4_bytes, 4_bytes, 4_bytes) */
  168. enum { uppgxConvertQDFontProcInfo = 0x00000FF1 };                 /* 4_bytes Func(4_bytes, 4_bytes, 4_bytes) */
  169. #define NewgxShapeSpoolProc(userRoutine)                         (gxShapeSpoolUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppgxShapeSpoolProcInfo, GetCurrentArchitecture())
  170. #define NewgxUserViewPortFilterProc(userRoutine)                 (gxUserViewPortFilterUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppgxUserViewPortFilterProcInfo, GetCurrentArchitecture())
  171. #define NewgxConvertQDFontProc(userRoutine)                     (gxConvertQDFontUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppgxConvertQDFontProcInfo, GetCurrentArchitecture())
  172. #define CallgxShapeSpoolProc(userRoutine, toSpool, refCon)         CALL_TWO_PARAMETER_UPP((userRoutine), uppgxShapeSpoolProcInfo, (toSpool), (refCon))
  173. #define CallgxUserViewPortFilterProc(userRoutine, toFilter, portOrder, refCon)  CALL_THREE_PARAMETER_UPP((userRoutine), uppgxUserViewPortFilterProcInfo, (toFilter), (portOrder), (refCon))
  174. #define CallgxConvertQDFontProc(userRoutine, dst, txFont, txFace)  CALL_THREE_PARAMETER_UPP((userRoutine), uppgxConvertQDFontProcInfo, (dst), (txFont), (txFace))
  175. typedef gxShapeSpoolProcPtr             gxShapeSpoolFunction;
  176. typedef gxUserViewPortFilterProcPtr     gxUserViewPortFilter;
  177. typedef gxConvertQDFontProcPtr             gxConvertQDFontFunction;
  178. /* mouse utilities */
  179. /* return mouse location in fixed-gxPoint global space */
  180. EXTERN_API_C( void )
  181. GXGetGlobalMouse                (gxPoint *                globalPt)                            THREEWORDINLINE(0x303C, 0x023C, 0xA832);
  182.  
  183. /* return fixed-gxPoint local mouse (gxViewPort == 0 --> default) */
  184. EXTERN_API_C( void )
  185. GXGetViewPortMouse                (gxViewPort             portOrder,
  186.                                  gxPoint *                localPt)                            THREEWORDINLINE(0x303C, 0x023D, 0xA832);
  187.  
  188. /* printing utilities */
  189. EXTERN_API_C( gxUserViewPortFilterUPP )
  190. GXGetViewPortFilter                (gxViewPort             portOrder,
  191.                                  long *                    refCon)                                THREEWORDINLINE(0x303C, 0x025E, 0xA832);
  192.  
  193. EXTERN_API_C( void )
  194. GXSetViewPortFilter                (gxViewPort             portOrder,
  195.                                  gxUserViewPortFilterUPP  filter,
  196.                                  long                     refCon)                                THREEWORDINLINE(0x303C, 0x023E, 0xA832);
  197.  
  198. /* QD to QD GX Translator functions */
  199. EXTERN_API_C( void )
  200. GXInstallQDTranslator            (GrafPtr                 port,
  201.                                  gxTranslationOption     options,
  202.                                  const Rect *            srcRect,
  203.                                  const Rect *            dstRect,
  204.                                  Point                     styleStrech,
  205.                                  gxShapeSpoolUPP         userFunction,
  206.                                  void *                    reference)                            THREEWORDINLINE(0x303C, 0x023F, 0xA832);
  207.  
  208. EXTERN_API_C( gxTranslationStatistic )
  209. GXRemoveQDTranslator            (GrafPtr                 port,
  210.                                  gxTranslationStatistic * statistic)                        THREEWORDINLINE(0x303C, 0x0240, 0xA832);
  211.  
  212. EXTERN_API_C( gxShape )
  213. GXConvertPICTToShape            (PicHandle                 pict,
  214.                                  gxTranslationOption     options,
  215.                                  const Rect *            srcRect,
  216.                                  const Rect *            dstRect,
  217.                                  Point                     styleStretch,
  218.                                  gxShape                 destination,
  219.                                  gxTranslationStatistic * stats)                            THREEWORDINLINE(0x303C, 0x0241, 0xA832);
  220.  
  221. /* Find the best GX style given a QD font and face. Called by the QD->GX translator */
  222. EXTERN_API_C( long )
  223. GXConvertQDFont                    (gxStyle                 theStyle,
  224.                                  long                     txFont,
  225.                                  long                     txFace)                                THREEWORDINLINE(0x303C, 0x0242, 0xA832);
  226.  
  227. EXTERN_API_C( gxConvertQDFontUPP )
  228. GXGetConvertQDFont                (void)                                                        THREEWORDINLINE(0x303C, 0x0243, 0xA832);
  229.  
  230. EXTERN_API_C( void )
  231. GXSetConvertQDFont                (gxConvertQDFontUPP     userFunction)                        THREEWORDINLINE(0x303C, 0x0244, 0xA832);
  232.  
  233. typedef unsigned long                     gxProfilePoolAttributes;
  234. struct gxFlatProfileListItem {
  235.     gxProfilePoolAttributes         attributes;                    /* information about this particular profile's source*/
  236.     CMProfileRef                     profileRef;                    /* reference to profile, only valid before shape is disposed*/
  237.     CMProfileIdentifier             identifier;                    /* information on how to find the profile upon unflattening*/
  238. };
  239. typedef struct gxFlatProfileListItem gxFlatProfileListItem;
  240.  
  241.  
  242.  
  243. #if defined(__MWERKS__) && TARGET_CPU_68K
  244.     #pragma pop
  245. #endif
  246.  
  247. #if PRAGMA_STRUCT_ALIGN
  248.     #pragma options align=reset
  249. #elif PRAGMA_STRUCT_PACKPUSH
  250.     #pragma pack(pop)
  251. #elif PRAGMA_STRUCT_PACK
  252.     #pragma pack()
  253. #endif
  254.  
  255. #ifdef PRAGMA_IMPORT_OFF
  256. #pragma import off
  257. #elif PRAGMA_IMPORT
  258. #pragma import reset
  259. #endif
  260.  
  261. #ifdef __cplusplus
  262. }
  263. #endif
  264.  
  265. #endif /* __GXENVIRONMENT__ */
  266.  
  267.